import { Random } from 'mockjs';

const resourcesResponse = () => {
  const dataList = [];
  for (let i = 0; i < 12; i++) {
    const data = {
      id: Random.id(),
      name: Random.ctitle(),
      description: Random.csentence(),
      img: Random.image('100x110'),
      loved: Random.integer(1, 1000),
    };
    dataList.push(data);
  }
  return {
    code: 200,
    data: dataList,
  };
};

export const mocks = [
  {
    url: /^\/api\/resources\/list/,
    method: 'get',
    response: resourcesResponse,
  },
  {
    url: /^\/api\/users\/love/,
    method: 'get',
    response: resourcesResponse,
  }
];
